package mapplayer.utils.astar
{
    /// マップのノード管理
	public class AStarNode
	{
        public var parent:AStarNode; ///< 親
        public var state:int;   ///< 状態
        public var x:int;       ///< X座標
        public var y:int;       ///< Y座標
        public var f_star:Number = 0;   ///< f*

        /// コンストラクタ
        public function AStarNode(x:int, y:int, state:int):void
        {
            this.x = x;
            this.y = y;
            this.state = state;
            parent = null;
        }

        /// 初期化
        public function clear():void{
            this.parent = null;
            this.f_star = 0;
			if (this.state != AStar.BLOCK) {
				this.state = AStar.OPEN;
			}
        }

        /// ゴールか？
        public function isGoalNode():Boolean{
            if(this.state == AStar.GOAL){
                return true;
            }
            return false;
        }

        /// 歩けるところか？
        public function isWalk():Boolean{
            if(this.state != AStar.BLOCK){
                return true;
            }
            return false;
        }
    }

}